package cn.com.cifi.mars.bean.vo.returnPlan;

import cn.com.cifi.mars.entity.ReturnPlanVersionDetail;
import cn.com.cifi.mars.util.BigDecimalUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author: JingYuanXiang
 * @date: 2020/11/7 17:03
 */
@Data
public class ReturnPlanDetailMonthData {

    @ApiModelProperty(name = "year", value = "年份")
    private int year;
    @ApiModelProperty(name = "month", value = "月份")
    private int month;
    @ApiModelProperty(name = "monthEarlyReceivable", value = "月初应收账款")
    BigDecimal monthEarlyReceivable;
    @ApiModelProperty(name = "monthSign", value = "月度签约")
    BigDecimal monthSign;
    @ApiModelProperty(name = "monthlyActualIncrementalReturn", value = "月度实际数-增量回款")
    BigDecimal monthlyActualIncrementalReturn;
    @ApiModelProperty(name = "monthlyActualStoreReturn", value = "月度实际数-存量回款")
    BigDecimal monthlyActualStoreReturn;
    @ApiModelProperty(name = "monthlyCalculateIncrementalReturn", value = "月度测算数-增量回款")
    BigDecimal monthlyCalculateIncrementalReturn;
    @ApiModelProperty(name = "monthlyCalculateStoreReturn", value = "月度测算数-存量回款")
    BigDecimal monthlyCalculateStoreReturn;
    @ApiModelProperty(name = "monthlyAdjustIncrementalReturn", value = "月度调整数-增量回款")
    BigDecimal monthlyAdjustIncrementalReturn;
    @ApiModelProperty(name = "monthlyAdjustStoreReturn", value = "月度调整数-存量回款")
    BigDecimal monthlyAdjustStoreReturn;
    @ApiModelProperty(name = "monthSignNotReturn", value = "月度已签未回回款数")
    BigDecimal monthSignNotReturn;
    @ApiModelProperty(name = "refundable", value = "期初应退回款数")
    private BigDecimal refundable;
    @ApiModelProperty(name = "monthlyTotalIncrementalReturn", value = "月度回款合计-增量回款")
    BigDecimal monthlyTotalIncrementalReturn;
    @ApiModelProperty(name = "monthlyTotalStoreReturn", value = "月度回款合计-存量回款")
    BigDecimal monthlyTotalStoreReturn;
    @ApiModelProperty(name = "monthlyTotalReturnTotal", value = "月度回款合计-回款合计")
    BigDecimal monthlyTotalReturnTotal;
    @ApiModelProperty(name = "monthlyTotalMonthEndReceivable", value = "月度回款合计-月末应收账款")
    BigDecimal monthlyTotalMonthEndReceivable;
    @ApiModelProperty(value = "累计年度签约合计")
    BigDecimal yearSignAmountTotal;
    @ApiModelProperty(value = "累计签约合计")
    BigDecimal signAmountTotal;
    @ApiModelProperty(value = "累计年度回款合计")
    BigDecimal yearReturnAmountTotal;
    @ApiModelProperty(value = "累计回款合计")
    BigDecimal returnAmountTotal;
    @ApiModelProperty(name = "signReturnRate", value = "累计签约回款率")
    BigDecimal signReturnRate;
    @ApiModelProperty(name = "annualOverallReturnRate", value = "年度综合回款率")
    BigDecimal annualOverallReturnRate;


    public void initialize() {
        this.monthEarlyReceivable = BigDecimal.ZERO;
        this.monthSign = BigDecimal.ZERO;
        this.monthlyActualIncrementalReturn = BigDecimal.ZERO;
        this.monthlyActualStoreReturn = BigDecimal.ZERO;
        this.monthlyCalculateIncrementalReturn = BigDecimal.ZERO;
        this.monthlyCalculateStoreReturn = BigDecimal.ZERO;
        this.monthlyAdjustIncrementalReturn = BigDecimal.ZERO;
        this.monthlyAdjustStoreReturn = BigDecimal.ZERO;
        this.monthSignNotReturn = BigDecimal.ZERO;
        this.refundable = BigDecimal.ZERO;
        this.monthlyTotalIncrementalReturn = BigDecimal.ZERO;
        this.monthlyTotalStoreReturn = BigDecimal.ZERO;
        this.monthlyTotalReturnTotal = BigDecimal.ZERO;
        this.monthlyTotalMonthEndReceivable = BigDecimal.ZERO;
        this.yearSignAmountTotal = BigDecimal.ZERO;
        this.signAmountTotal = BigDecimal.ZERO;
        this.yearReturnAmountTotal = BigDecimal.ZERO;
        this.returnAmountTotal = BigDecimal.ZERO;
        this.signReturnRate = BigDecimal.ZERO;
        this.annualOverallReturnRate = BigDecimal.ZERO;

    }

    public void initialize(ReturnPlanVersionDetail detail) {
        this.monthEarlyReceivable = detail.getEarlyReceivableAmount();
        this.monthSign = BigDecimal.ZERO;
        this.monthlyActualIncrementalReturn = BigDecimal.ZERO;
        this.monthlyActualStoreReturn = BigDecimal.ZERO;
        this.monthlyCalculateIncrementalReturn = BigDecimal.ZERO;
        this.monthlyCalculateStoreReturn = BigDecimal.ZERO;
        this.monthlyAdjustIncrementalReturn = BigDecimal.ZERO;
        this.monthlyAdjustStoreReturn = BigDecimal.ZERO;
        this.monthSignNotReturn = detail.getSignedUnrecovered();
        this.refundable = BigDecimal.ZERO;
        this.monthlyTotalIncrementalReturn = BigDecimal.ZERO;
        this.monthlyTotalStoreReturn = BigDecimal.ZERO;
        this.monthlyTotalReturnTotal = BigDecimal.ZERO;
        this.monthlyTotalMonthEndReceivable = detail.getFinalReceivable();
        this.yearSignAmountTotal = detail.getYearSignAmountTotal();
        this.signAmountTotal = detail.getSignAmountTotal();
        this.yearReturnAmountTotal = detail.getYearReturnAmountTotal();
        this.returnAmountTotal = detail.getReturnAmountTotal();
        this.signReturnRate = detail.getSignReturnRate();
        this.annualOverallReturnRate = detail.getAnnualOverallReturnRate();
    }
}
